home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Multiple Child Objects.dir / 00001_Main Movie Script.ls next >
Encoding:
Text File  |  1997-05-10  |  1.5 KB  |  54 lines

  1. on prepareMovie
  2.   global ballList, paddleSprite
  3.   set ballList to []
  4.   set paddleSprite to 4
  5.   puppetSprite(paddleSprite, 1)
  6.   puppetSprite(6, 1)
  7.   repeat with currentChannel = 10 to 19
  8.     puppetSprite(currentChannel, 1)
  9.     set the stretch of sprite currentChannel to 1
  10.   end repeat
  11. end
  12.  
  13. on DoButton
  14.   if (the mouseCast = the number of member "New Color Art") or (the mouseCast = the number of member "New Color Text") then
  15.     createBall(1)
  16.   else
  17.     if (the mouseCast = the number of member "New BW Art") or (the mouseCast = the number of member "New BW Text") then
  18.       createBall(0)
  19.     else
  20.       placePaddle()
  21.     end if
  22.   end if
  23. end
  24.  
  25. on placePaddle
  26.   global paddleSprite
  27.   set the locH of sprite paddleSprite to the mouseH
  28.   set the locV of sprite paddleSprite to the mouseV
  29.   set the locH of sprite 6 to the locH of sprite paddleSprite - (0.5 * the width of sprite 6)
  30.   set the locV of sprite 6 to the locV of sprite paddleSprite - ((0.80000000000000004 * the height of sprite 6) + (0.25 * the height of sprite paddleSprite))
  31. end
  32.  
  33. on createBall whichType
  34.   global ball1, ballList
  35.   if count(ballList) >= 10 then
  36.     beep()
  37.   else
  38.     if whichType = 1 then
  39.       add(ballList, new(script "Color Parent", count(ballList) + 1))
  40.     else
  41.       add(ballList, new(script "BW Parent", count(ballList) + 1))
  42.     end if
  43.   end if
  44. end
  45.  
  46. on DoAnimation
  47.   global ball1, ballList
  48.   if count(ballList) > 0 then
  49.     repeat with t = 1 to count(ballList)
  50.       animateBall(getAt(ballList, t))
  51.     end repeat
  52.   end if
  53. end
  54.